import { DataTypes, Model } from 'sequelize';
import sequelize from '../db';

class RolePermission extends Model {
  public roleId!: string;
  public permissionId!: string;
  public readonly createdAt!: Date;
}

RolePermission.init(
  {
    roleId: {
      type: DataTypes.UUID,
      allowNull: false,
      field: 'role_id',
    },
    permissionId: {
      type: DataTypes.UUID,
      allowNull: false,
      field: 'permission_id',
    },
  },
  {
    sequelize,
    tableName: 'role_permissions',
    underscored: true,
    timestamps: false,
    createdAt: 'created_at',
    updatedAt: false,
  },
);

export default RolePermission;

